<template>
	<view class="examine-container">
		<view class="examine-list">
			<view class="examine-item" v-for="item in listData" :key="item.id">
				<view class="examine-head">
					<text class="label">招聘考试</text>
					<text class="sub-title">{{ item.recruitTitle }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">单位名称： </text>
					<text class="label-value">{{ item.employer }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">岗位名称：</text>
					<text class="label-value">{{ item.positionName }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">姓 名： </text>
					<text class="label-value">{{ item.fullName }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">联系方式： </text>
					<text class="label-value">{{ item.contactInformation }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">报名时间： </text>
					<text class="label-value">{{ item.registrationTime }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">报考编码： </text>
					<text class="label-value">{{ item.recCode }}</text>
				</view>
				<view class="info-item">
					<text class="label-tip">考试状态： </text>
					<text :class="['status', mapAuditStatus(item.auditStatus).class]">{{ mapAuditStatus(item.auditStatus).text }}</text>
					<!-- <view class="">
						<text :class="['status', mapAuditStatus(item.auditStatus).class]">{{ mapAuditStatus(item.auditStatus).text }}</text>
						<view class="fail-reson">
							<view style="color: #FF7F1C;font-size: 24rpx;">{{ item.auditOpinion }}</view>
							<view style="color: #FF7F1C;font-size: 24rpx;">{{ item.auditTime }}</view>
						</view>
					</view> -->
				</view>

				<view class="btn-wrap">
					<!-- <button class="result-btn">结果公示</button> -->
					<button class="examine-btn" @click="handleDetail(item)">查看详情</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		enrollList,
	} from '@/common/api_examine.js'
	export default {
		data() {
			return {
				listData: []
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			async getList() {
				const res = await enrollList()
				if (res.code === 200) {
					this.listData = res.data
					// this.listData[0].auditStatus = 7
				}
			},
			handleDetail(item) {
				uni.navigateTo({
					url: `/subpage/examine/examinedetail?id=${item.id}`
				})
			},
			mapAuditStatus(type) {
				// 1等待报名审核 2审核不通过 3审核通过，请缴纳报名费 4审核通过，请等待考试安排 5缴费成功，请等待考试安排 6缴费不通过 7请下载笔试准考证 8查看成绩
				switch (type) {
					case 1:
						return {
							class: 'wait',
							text: '等待报名审核'
						}
					case 2:
						return {
							class: 'fail',
							text: '审核不通过'
						}
					case 3:
						return {
							class: 'pass',
							text: '审核通过，请缴纳报名费'
						}
					case 4:
						return {
							class: 'pass',
							text: '审核通过，请等待考试安排'
						}
					case 5:
						return {
							class: 'pass',
							text: '缴费成功，请等待考试安排'
						}
					case 6:
						return {
							class: 'fail',
							text: '缴费失败，请重新上传缴费证明'
						}
					case 7:
						return {
							class: 'wait',
							text: '请下载笔试准考证'
						}
					case 8:
						return {
							class: 'wait',
							text: '查看成绩'
						}
					case 9:
						return {
							class: 'wait',
							text: '缴费证明审核中'
						}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.examine-container {
		min-height: 100vh;
		padding: 24rpx 32rpx 0;
		background: #F2F5FF;
		box-sizing: border-box;

		.examine-list {
			.examine-item {
				width: 100%;
				padding: 30rpx 28rpx 28rpx 32rpx;
				margin-bottom: 32rpx;
				box-sizing: border-box;
				border-radius: 40rpx;
				background-color: #fff;

				.examine-head {
					margin-bottom: 4rpx;

					.label {
						display: inline-block;
						padding: 6rpx 12rpx;
						margin-right: 12rpx;
						font-size: 22rpx;
						color: #34314F;
						line-height: 24rpx;
						text-align: center;
						background: #F0F0F2;
						border-radius: 12rpx;
					}

					.sub-title {
						font-weight: 600;
						font-size: 32rpx;
						color: #34314F;
						line-height: 44rpx;
						text-align: left;
					}
				}

				.examine-title {
					margin-bottom: 16rpx;
					font-weight: 600;
					font-size: 32rpx;
					color: #34314F;
					line-height: 44rpx;
					text-align: left;


				}

				.info-item {
					display: flex;
					margin-bottom: 24rpx;

					.label-tip {
						min-width: 130rpx;
						font-weight: 400;
						font-size: 26rpx;
						color: #9A98A7;
						line-height: 22px;
						font-style: normal;
						text-align: justify;
						text-align-last: justify
					}

					.label-value {
						font-weight: 400;
						font-size: 26rpx;
						color: #34314F;
						line-height: 22px;
						text-align: left;
						font-style: normal;
					}

					.status {
						font-weight: 600;
						font-size: 26rpx;
						line-height: 22px;
						text-align: left;
						font-style: normal;
						&.wait {
							color: #FF7F1C;
						}
						&.fail {
							color: #34314F;
						}
						&.pass {
							color: #1FBF70;
						}
					}
				}

				.btn-wrap {
					// bottom: 28rpx;
					// right: 28rpx;
					display: flex;
					justify-content: flex-end;

					.result-btn {
						width: 176rpx;
						height: 64rpx;
						margin: 0;
						background: #F0F0F2;
						border-radius: 40px;
						text-align: center;
						font-weight: 600;
						font-size: 14px;
						color: #34314F;
						line-height: 64rpx;
						font-style: normal;

						&::after {
							border: 0;
						}
					}

					.examine-btn {
						width: 176rpx;
						height: 64rpx;
						margin: 0 0 0 28rpx;
						background: #FFDE6D;
						border-radius: 40px;
						text-align: center;
						font-weight: 600;
						font-size: 14px;
						color: #34314F;
						line-height: 64rpx;
						font-style: normal;

						&::after {
							border: 0;
						}
					}
				}
			}
		}
	}
</style>